Skip to content

feat: broken-anchor indicator for orphaned annotations#352

Open
leotrs wants to merge 19 commits intomainfrom
std-2roe
Open

feat: broken-anchor indicator for orphaned annotations#352
leotrs wants to merge 19 commits intomainfrom
std-2roe

Conversation

@leotrs
Copy link
Copy Markdown
Collaborator

@leotrs leotrs commented Mar 27, 2026

Summary

  • When an annotation's anchor can't be resolved (text deleted, structure changed), the card now shows a visual "Original text no longer found" warning banner with an AlertTriangle icon
  • Orphaned cards get a dashed left border and reduced opacity to distinguish them from anchored annotations
  • DockableAnnotations tracks orphaned IDs during sort and passes orphaned prop to Note component

Test plan

  • Verify orphaned annotations show the warning banner in the sidebar
  • Verify anchored annotations do NOT show the banner
  • Verify delete still works on orphaned annotations
  • Verify collapsing an orphaned card hides the banner (shows collapsed preview)
  • 12 new unit tests covering orphan detection and UI rendering

🤖 Generated with Claude Code

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for rsm-studio-site canceled.

Name Link
🔨 Latest commit 8439f5a
🔍 Latest deploy log https://app.netlify.com/projects/rsm-studio-site/deploys/69c9553265b8c600084e0754

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for rsm-studio-frontend canceled.

Name Link
🔨 Latest commit 8439f5a
🔍 Latest deploy log https://app.netlify.com/projects/rsm-studio-frontend/deploys/69c955328c8bec0008e64756

@leotrs
Copy link
Copy Markdown
Collaborator Author

leotrs commented Mar 27, 2026

Needs human review

What changed: Orphaned annotations now show a visual "Original text no longer found" warning banner with dashed border and reduced opacity. Per-message edit/delete buttons added to annotation cards. Shared card design overhauled (removed top border, added subtle shadow). Delete blocked on shared annotation messages (new 403). updated_at column added to annotation messages with "edited" indicator.

Review checklist:

  1. Open the deploy preview: https://deploy-preview-352--rsm-studio-frontend.netlify.app
  2. Open a document with annotations, then delete the anchored text for one annotation — verify the orphaned card shows a dashed left border, reduced opacity, and an orange "Original text no longer found" banner
  3. Hover over the orphaned card — verify opacity returns to full
  4. Collapse the orphaned card — verify the banner disappears (only collapsed preview shown)
  5. Click delete on the orphaned card — verify it still works
  6. On a private annotation, activate the card and verify Edit and Delete buttons appear below the note text
  7. Edit a private note — verify the inline textarea appears, Save/Cancel work, and an "edited" tag appears after saving
  8. Delete a private note — verify the two-click confirmation pattern (first click arms, second click deletes)
  9. On a shared annotation thread, activate the card and verify the inline edit pencil icon appears on hover for your own messages
  10. Edit a shared thread message — verify the inline textarea and "edited" tag behavior
  11. Verify there is no delete button on individual shared thread messages
  12. Check that the shared card redesign looks correct: no top colored border, subtle shadow instead of border, italic quoted text with background

What to look for:

  • Orphan banner alignment, icon color (orange), and text readability
  • Dashed border style and opacity transition on orphaned cards
  • Edit/delete buttons only appear for your own messages
  • "edited" tag with middle-dot separator renders correctly in both header (private) and thread message header (shared)
  • Shared card shadow looks clean — no double borders or visual artifacts
  • Avatar size change (16px → 12px) doesn't break layout elsewhere
  • No regressions on non-orphaned annotation cards

leotrs and others added 3 commits March 29, 2026 12:08
…rk unwrap

Backend: add updated_at column to annotation_messages, set on edit, block
DELETE on shared annotations. Frontend: per-message edit/delete with inline
actions (Proposal C), shared annotation card visual redesign (shadow-based,
tinted quote, no colored borders), fix clearHighlights DOM corruption when
unwrapping nested/overlapping marks by processing innermost-first and
deferring normalize().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When an annotation's anchor text can no longer be found in the document,
the card now displays a warning banner ("Original text no longer found")
with an AlertTriangle icon and dashed border styling. Orphaned IDs are
tracked in DockableAnnotations and passed as a prop to Note.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The shared card redesign intentionally removed the Avatar from the
header. Update the E2E test to match the new design.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leotrs leotrs closed this Mar 29, 2026
@leotrs leotrs reopened this Mar 29, 2026
leotrs and others added 5 commits March 29, 2026 15:05
…build

Merge conflict from a prior commit left duplicate declarations of
onCancelMessageEdit, onDeleteMessageClick, onDeleteMessage, and
onPostReply. The first set contained broken implementations (e.g.
onPostReply called updateNote instead of addNote with undefined vars).
Kept the correct second set which has proper error handling and toasts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Preview Deploy

Frontend: https://pr-352--rsm-studio-frontend.netlify.app
Backend: https://aris-backend-pr-352.fly.dev
API docs: https://aris-backend-pr-352.fly.dev/docs

This preview will be destroyed when the PR is closed.

leotrs and others added 9 commits March 29, 2026 16:11
…t focus outline

The active class and editing class were not accounting for the per-message
edit flow (editingMessageId), causing the active border to remain visible
during editing. Also added missing .edit-input:focus outline style for a11y.
Updated tests to match the per-message edit flow.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@leotrs
Copy link
Copy Markdown
Collaborator Author

leotrs commented Mar 29, 2026

Needs human review

What changed: Orphaned annotations (anchor text deleted/changed) now show a warning banner with "Original text no longer found", dashed left border, and reduced opacity. Also replaced TextareaInput with native <textarea> for message editing and removed toast error feedback on save/edit failures.

Review checklist:

  1. Open the app and create an annotation on some text
  2. Delete or modify the anchored text so the annotation becomes orphaned
  3. Verify the orphaned card shows the orange "Original text no longer found" banner with AlertTriangle icon
  4. Verify the orphaned card has a dashed left border and slightly reduced opacity (0.75)
  5. Hover over the orphaned card — opacity should return to 1
  6. Collapse the orphaned card — the banner should disappear, showing only the collapsed preview
  7. Verify non-orphaned annotations do NOT show the banner or dashed border
  8. Try deleting an orphaned annotation — should still work
  9. Edit a message on any annotation — verify the native textarea works (Enter to save, Esc to cancel)
  10. Trigger an edit save failure (e.g., disconnect network) — verify no toast appears but the edit area closes gracefully

What to look for:

  • Orange banner styling matches the design system (consistent with other warning states)
  • Dashed border is visually distinct but not distracting
  • Opacity transition on hover feels smooth
  • Native textarea edit experience is equivalent to the previous TextareaInput component (no regressions in keyboard handling)
  • Removal of toast error feedback is intentional — confirm no silent failures confuse users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant